package cn.edu.nchu.entity.utils;

import com.alibaba.fastjson.JSONObject;

public class JSONUtil {
    public static boolean isJsonStr(String str){
        try{
            JSONObject.parseObject(str);
        } catch (Exception e) {
            return false;
        }
        return true;
    }

    public static String warp2JsonStr(String str){
        return "{\"str\":\"" + str + "\"}";
    }

    public static JSONObject str2JSONObject(String str) {
        try{
            return JSONObject.parseObject(str);
        } catch (Exception e) {
            return JSONObject.parseObject(warp2JsonStr(str));
        }
    }

    public static void main(String[] args) {

    }
}
